home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-04d.zip / 04d / CHIP / Porady / Skuteczne wymazywanie danych / Device Seizure / deviceseizure.exe / RCDATA / CABINET / DeviceSeizureSetup.MSI / HostControl.pm.D1CD4BD6_5A74_4973_92E5_E1268B8DA27B < prev    next >
Text File  |  2005-11-18  |  27KB  |  898 lines

  1. ########################################################################
  2. #
  3. #    File:            HostControl.pm
  4. #
  5. #    Purpose:        Perl wrappers for Palm OS Emulator HostControl 
  6. #                    functions.
  7. #
  8. #    Description:    This file contains Perl equivalents of Palm OS
  9. #                    Emulator Host Control functions, like HostGetHostID,
  10. #                    HostGetHostVersion, HostProfileStart etc...
  11. #
  12. #                    In general, functions follow the calling
  13. #                    conventions in the SDK headers.  However, there
  14. #                    are exceptions.  See the comments before each
  15. #                    subroutine for details.
  16. #
  17. ########################################################################
  18.  
  19. package HostControl;
  20.  
  21. use EmRPC qw(DoRPC);
  22. use EmSysTraps;
  23.  
  24. use strict;
  25. use vars qw(@ISA @EXPORT);
  26.  
  27. use Exporter;
  28. @ISA = qw(Exporter);
  29.  
  30. @EXPORT = qw(
  31.  
  32.     HostGetHostVersion HostGetHostID HostGetHostPlatform 
  33.     HostIsSelectorImplemented HostGestalt HostIsCallingTrap
  34.     
  35.     HostProfileInit HostProfileStart HostProfileStop HostProfileDump 
  36.     HostProfileCleanup HostProfileDetailFn
  37.     
  38.     HostErrNo HostFClose HostFEOF HostFError HostFFlush HostFGetC 
  39.     HostFGetPos HostFGetS HostFOpen HostFPrintF HostFPutC HostFPutS 
  40.     HostFRead HostRemove HostRename HostFReopen HostFScanF HostFSeek 
  41.     HostFSetPos HostFTell HostFWrite HostTmpFile HostTmpNam HostGetEnv
  42.  
  43.     HostMalloc HostRealloc HostFree
  44.  
  45.     HostGremlinIsRunning HostGremlinNumber HostGremlinCounter 
  46.     HostGremlinLimit HostGremlinNew
  47.     
  48.     HostImportFile HostExportFile
  49.  
  50.     HostGetPreference HostSetPreference
  51.  
  52.     HostLogFile HostSetLogFileSize
  53.  
  54.     HostSessionCreate HostSessionOpen HostSessionClose HostSessionQuit 
  55.     HostSignalSend HostSignalWait HostSignalResume
  56.  
  57.     HostTraceInit HostTraceClose HostTraceOutputT HostTraceOutputTL 
  58.     HostTraceOutputVT HostTraceOutputVTL HostTraceOutputB
  59.  
  60. );
  61.  
  62. #// HostControl.h functions.
  63.  
  64. # Host information selectors
  65. use constant hostSelectorGetHostVersion            => 0x0100;
  66. use constant hostSelectorGetHostID                => 0x0101;
  67. use constant hostSelectorGetHostPlatform        => 0x0102;
  68. use constant hostSelectorIsSelectorImplemented    => 0x0103;
  69. use constant hostSelectorGestalt                => 0x0104;
  70. use constant hostSelectorIsCallingTrap            => 0x0105;
  71.  
  72. # Profiler Selectors
  73. use constant hostSelectorProfileInit            => 0x0200;
  74. use constant hostSelectorProfileStart            => 0x0201;
  75. use constant hostSelectorProfileStop            => 0x0202;
  76. use constant hostSelectorProfileDump            => 0x0203;
  77. use constant hostSelectorProfileCleanup            => 0x0204;
  78. use constant hostSelectorProfileDetailFn        => 0x0205;
  79.  
  80. # Std C Library wrapper selectors
  81.  
  82. use constant hostSelectorErrNo                    => 0x0300;
  83.  
  84. use constant hostSelectorFClose                    => 0x0301;
  85. use constant hostSelectorFEOF                    => 0x0302;
  86. use constant hostSelectorFError                    => 0x0303;
  87. use constant hostSelectorFFlush                    => 0x0304;
  88. use constant hostSelectorFGetC                    => 0x0305;
  89. use constant hostSelectorFGetPos                => 0x0306;
  90. use constant hostSelectorFGetS                    => 0x0307;
  91. use constant hostSelectorFOpen                    => 0x0308;
  92. use constant hostSelectorFPrintF                => 0x0309;        # Floating point not yet supported in Poser
  93. use constant hostSelectorFPutC                    => 0x030A;
  94. use constant hostSelectorFPutS                    => 0x030B;
  95. use constant hostSelectorFRead                    => 0x030C;
  96. use constant hostSelectorRemove                    => 0x030D;        # Not yet implemented in Poser
  97. use constant hostSelectorRename                    => 0x030E;        # Not yet implemented in Poser
  98. use constant hostSelectorFReopen                => 0x030F;        # Not yet implemented in Poser
  99. use constant hostSelectorFScanF                    => 0x0310;        # Not yet implemented in Poser
  100. use constant hostSelectorFSeek                    => 0x0311;
  101. use constant hostSelectorFSetPos                => 0x0312;
  102. use constant hostSelectorFTell                    => 0x0313;
  103. use constant hostSelectorFWrite                    => 0x0314;
  104. use constant hostSelectorTmpFile                => 0x0315;
  105. use constant hostSelectorTmpNam                    => 0x0316;        # Not yet implemented in Poser
  106. use constant hostSelectorGetEnv                    => 0x0317;
  107.  
  108. use constant hostSelectorMalloc                    => 0x0318;        # Not yet implemented in Poser
  109. use constant hostSelectorRealloc                => 0x0319;        # Not yet implemented in Poser
  110. use constant hostSelectorFree                    => 0x031A;        # Not yet implemented in Poser
  111.  
  112. # Gremlin Selectors
  113. use constant hostSelectorGremlinIsRunning        => 0x0400;
  114. use constant hostSelectorGremlinNumber            => 0x0401;
  115. use constant hostSelectorGremlinCounter            => 0x0402;
  116. use constant hostSelectorGremlinLimit            => 0x0403;
  117. use constant hostSelectorGremlinNew                => 0x0404;
  118.  
  119. # Database Selectors
  120. use constant hostSelectorImportFile                => 0x0500;
  121. use constant hostSelectorExportFile                => 0x0501;
  122.  
  123. # Preference Selectors
  124. use constant hostSelectorGetPreference            => 0x0600;
  125. use constant hostSelectorSetPreference            => 0x0601;
  126.  
  127. # Logging Selectors
  128. use constant hostSelectorLogFile                => 0x0700;
  129. use constant hostSelectorSetLogFileSize            => 0x0701;
  130.  
  131. # RPC Selectors
  132. use constant hostSelectorSessionCreate            => 0x0800;        # Not yet implemented in Poser
  133. use constant hostSelectorSessionOpen            => 0x0801;        # Not yet implemented in Poser
  134. use constant hostSelectorSessionClose            => 0x0802;
  135. use constant hostSelectorSessionQuit            => 0x0803;
  136. use constant hostSelectorSignalSend                => 0x0804;
  137. use constant hostSelectorSignalWait                => 0x0805;
  138. use constant hostSelectorSignalResume            => 0x0806;
  139.  
  140. # External tracing tool support
  141. use constant hostSelectorTraceInit                => 0x0900;
  142. use constant hostSelectorTraceClose                => 0x0901;
  143. use constant hostSelectorTraceOutputT            => 0x0902;
  144. use constant hostSelectorTraceOutputTL            => 0x0903;
  145. use constant hostSelectorTraceOutputVT            => 0x0904;
  146. use constant hostSelectorTraceOutputVTL            => 0x0905;
  147. use constant hostSelectorTraceOutputB            => 0x0906;
  148.  
  149. use constant hostSelectorLastTrapNumber            => 0x0907;
  150.  
  151.  
  152. #/* ==================================================================== */
  153. #/* Host environment-related calls                                         */
  154. #/* ==================================================================== */
  155.  
  156. ########################################################################
  157. #
  158. #    FUNCTION:        HostGetHostVersion
  159. #
  160. #    DESCRIPTION:    Get the version number of the host (Palm OS Emulator).
  161. #
  162. #    PARAMETERS:        None
  163. #
  164. #    RETURNS:        Version number of Poser in Palm OS version format.
  165. #
  166. ########################################################################
  167.  
  168. sub HostGetHostVersion
  169. {
  170.     # long HostGetHostVersion(void)
  171.  
  172.     my ($return, $format) = ("int32", "int16");
  173.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  174.                         hostSelectorGetHostVersion, @_);
  175.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  176. }
  177.  
  178.  
  179. ########################################################################
  180. #
  181. #    FUNCTION:        HostGetHostID
  182. #
  183. #    DESCRIPTION:    Get the ID of the debugging host.
  184. #
  185. #    PARAMETERS:        None
  186. #
  187. #    RETURNS:        hostIDPalmOS, hostIDPalmOSEmulator, hostIDPalmOSSimulator 
  188. #                    etc...
  189. #
  190. ########################################################################
  191.  
  192. sub HostGetHostID
  193. {
  194.     # HostID HostGetHostID(void)
  195.  
  196.     my ($return, $format) = ("int32", "int16");
  197.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  198.                         hostSelectorGetHostID, @_);
  199.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  200. }
  201.  
  202.  
  203. ########################################################################
  204. #
  205. #    FUNCTION:        HostGetHostPlatform
  206. #
  207. #    DESCRIPTION:    Get the host platform ID.
  208. #                    hostPlatformPalmOS, hostPlatformWindows, 
  209. #                    hostPlatformMacintosh, hostPlatformUnix etc...
  210. #
  211. #    PARAMETERS:        None
  212. #
  213. #    RETURNS:        hostPlatformPalmOS, hostPlatformWindows, 
  214. #                    hostPlatformMacintosh, hostPlatformUnix etc...
  215. #
  216. ########################################################################
  217.  
  218. sub HostGetHostPlatform
  219. {
  220.     # HostPlatform HostGetHostPlatform(void)
  221.  
  222.     my ($return, $format) = ("int32", "int16");
  223.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  224.                         hostSelectorGetHostPlatform, @_);
  225.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  226. }
  227.  
  228.  
  229. ########################################################################
  230. #
  231. #    FUNCTION:        HostIsSelectorImplemented
  232. #
  233. #    DESCRIPTION:    Determines if the particular selector is implemented.
  234. #
  235. #    PARAMETERS:        None
  236. #
  237. #    RETURNS:        True or False.
  238. #
  239. ########################################################################
  240.  
  241. sub HostIsSelectorImplemented
  242. {
  243.     # HostBool HostIsSelectorImplemented(long selector)
  244.  
  245.     my ($return, $format) = ("int32", "int16 int32");
  246.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  247.                         hostSelectorIsSelectorImplemented, @_);
  248.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  249. }
  250.  
  251.  
  252. ########################################################################
  253. #
  254. #    FUNCTION:        HostGestalt
  255. #
  256. #    DESCRIPTION:    Return queries about the Runtime environment.
  257. #
  258. #    PARAMETERS:        None
  259. #
  260. #    RETURNS:        Runtime environment info.
  261. #
  262. ########################################################################
  263.  
  264. sub HostGestalt
  265. {
  266.     # HostErr HostGestalt(long gestSel, long* response)
  267.  
  268.     my ($return, $format) = ("HostErr", "int16 int32 rptr");
  269.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  270.                         hostSelectorGestalt, @_);
  271.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  272. }
  273.  
  274.  
  275. ########################################################################
  276. #
  277. #    FUNCTION:        HostIsCallingTrap
  278. #
  279. #    DESCRIPTION:    Determines if the Palm OS Emulator is currently
  280. #                    calling a trap.  True if so, false if not.
  281. #
  282. #    PARAMETERS:        None
  283. #
  284. #    RETURNS:        True if trap is being called, false if not.
  285. #
  286. ########################################################################
  287.  
  288. sub HostIsCallingTrap
  289. {
  290.     # HostBool HostIsCallingTrap(void)
  291.  
  292.     my ($return, $format) = ("int32", "int16");
  293.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  294.                         hostSelectorIsCallingTrap, @_);
  295.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  296. }
  297.  
  298.  
  299. #/* ==================================================================== */
  300. #/* Profiling-related calls                                                 */
  301. #/* ==================================================================== */
  302.  
  303.  
  304. ########################################################################
  305. #
  306. #    FUNCTION:        HostProfileInit
  307. #
  308. #    DESCRIPTION:    Initializes and enables profiling in debugging host.
  309. #
  310. #    PARAMETERS:        None
  311. #
  312. #    RETURNS:        Returns zero if successful, non-zero otherwise.
  313. #
  314. ########################################################################
  315.  
  316. sub HostProfileInit
  317. {
  318.     # HostErr HostProfileInit(long maxCalls, long maxDepth)
  319.  
  320.     my ($return, $format) = ("HostErr", "int16 int32 int32");
  321.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  322.                         hostSelectorProfileInit, @_);
  323.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  324. }
  325.  
  326.  
  327. ########################################################################
  328. #
  329. #    FUNCTION:        HostProfileDetailFn
  330. #
  331. #    DESCRIPTION:    Profiles the function that contains the specified 
  332. #                    address.
  333. #
  334. #    PARAMETERS:        None
  335. #
  336. #    RETURNS:        Returns zero if successful, non-zero otherwise.
  337. #
  338. ########################################################################
  339.  
  340. sub HostProfileDetailFn
  341. {
  342.     # HostErr HostProfileDetailFn(void* addr, HostBool logDetails)
  343.  
  344.     my ($return, $format) = ("HostErr", "int16 rptr int32");
  345.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  346.                         hostSelectorProfileDetailFn, @_);
  347.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  348. }
  349.  
  350.  
  351. ########################################################################
  352. #
  353. #    FUNCTION:        HostProfileStart
  354. #
  355. #    DESCRIPTION:    Turns Profiling on.
  356. #
  357. #    PARAMETERS:        None
  358. #
  359. #    RETURNS:        Returns zero if successful, non-zero otherwise.
  360. #
  361. ########################################################################
  362.  
  363. sub HostProfileStart
  364. {
  365.     # HostErr HostProfileStart(void)
  366.  
  367.     my ($return, $format) = ("HostErr", "int16");
  368.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  369.                         hostSelectorProfileStart, @_);
  370.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  371. }
  372.  
  373.  
  374. ########################################################################
  375. #
  376. #    FUNCTION:        HostProfileStop
  377. #
  378. #    DESCRIPTION:    Initializes and enables profiling in debugging host.
  379. #
  380. #    PARAMETERS:        None
  381. #
  382. #    RETURNS:        Returns zero if successful, non-zero otherwise.
  383. #
  384. ########################################################################
  385.  
  386. sub HostProfileStop
  387. {
  388.     # HostErr HostProfileStop(void)
  389.  
  390.     my ($return, $format) = ("HostErr", "int16");
  391.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  392.                         hostSelectorProfileStop, @_);
  393.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  394. }
  395.  
  396.  
  397. ########################################################################
  398. #
  399. #    FUNCTION:        HostProfileDump
  400. #
  401. #    DESCRIPTION:    Writes the current profiling information to the 
  402. #                    named file.
  403. #
  404. #    PARAMETERS:        None
  405. #
  406. #    RETURNS:        Returns zero if successful, non-zero otherwise.
  407. #
  408. ########################################################################
  409.  
  410. sub HostProfileDump
  411. {
  412.     # HostErr HostProfileDump(const char* filename)
  413.  
  414.     my ($return, $format) = ("HostErr", "int16 string");
  415.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  416.                         hostSelectorProfileDump, @_);
  417.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  418. }
  419.  
  420.  
  421. ########################################################################
  422. #
  423. #    FUNCTION:        HostProfileCleanup
  424. #
  425. #    DESCRIPTION:    Initializes and enables profiling in debugging host.
  426. #
  427. #    PARAMETERS:        None
  428. #
  429. #    RETURNS:        Returns zero if successful, non-zero otherwise.
  430. #
  431. ########################################################################
  432.  
  433. sub HostProfileCleanup
  434. {
  435.     # HostErr HostProfileCleanup(void)
  436.  
  437.     my ($return, $format) = ("HostErr", "int16");
  438.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  439.                         hostSelectorProfileCleanup, @_);
  440.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  441. }
  442.  
  443.  
  444. #/* ==================================================================== */
  445. #/* Std C Library-related calls                                             */
  446. #/*     ADD LATER!!!                                                     */
  447. #/* ==================================================================== */
  448.  
  449.  
  450. #/* ==================================================================== */
  451. #/* Gremlin-related calls                                                 */
  452. #/* ==================================================================== */
  453.  
  454.  
  455. ########################################################################
  456. #
  457. #    FUNCTION:        HostGremlinIsRunning
  458. #
  459. #    DESCRIPTION:    Determines if Gremlin is currently running.
  460. #
  461. #    PARAMETERS:        None
  462. #
  463. #    RETURNS:        True if a gremlin is currently running, False otherwise.
  464. #
  465. ########################################################################
  466.  
  467. sub HostGremlinIsRunning
  468. {
  469.     # HostBool HostGremlinIsRunning(void)
  470.  
  471.     my ($return, $format) = ("int32", "int16");
  472.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  473.                         hostSelectorGremlinIsRunning, @_);
  474.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  475. }
  476.  
  477.  
  478. ########################################################################
  479. #
  480. #    FUNCTION:        HostGremlinNumber
  481. #
  482. #    DESCRIPTION:    Retrieves the number of the currently running gremlin.
  483. #
  484. #    PARAMETERS:        None
  485. #
  486. #    RETURNS:        The number of the current gremlin.
  487. #                    Only valid if a gremlin is currently executing.
  488. #
  489. ########################################################################
  490.  
  491. sub HostGremlinNumber
  492. {
  493.     # long HostGremlinNumber(void)
  494.  
  495.     my ($return, $format) = ("int32", "int16");
  496.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  497.                         hostSelectorGremlinNumber, @_);
  498.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  499. }
  500.  
  501.  
  502. ########################################################################
  503. #
  504. #    FUNCTION:        HostGremlinCounter
  505. #
  506. #    DESCRIPTION:    Returns the current event counter of the currently 
  507. #                    running gremlin.
  508. #
  509. #    PARAMETERS:        None
  510. #
  511. #    RETURNS:        Current event counter.  
  512. #                    Only valid if a gremlin is currently executing.
  513. #
  514. ########################################################################
  515.  
  516. sub HostGremlinCounter
  517. {
  518.     # long HostGremlinCounter(void)
  519.  
  520.     my ($return, $format) = ("int32", "int16");
  521.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  522.                         hostSelectorGremlinCounter, @_);
  523.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  524. }
  525.  
  526.  
  527. ########################################################################
  528. #
  529. #    FUNCTION:        HostGremlinLimit
  530. #
  531. #    DESCRIPTION:    Retrieves the limit value of the currently running gremlin.
  532. #
  533. #    PARAMETERS:        None
  534. #
  535. #    RETURNS:        Limit value of the currently running gremlin.
  536. #                    Only valid if a gremlin is currently executing.
  537. #
  538. ########################################################################
  539.  
  540. sub HostGremlinLimit
  541. {
  542.     # long HostGremlinLimit(void)
  543.  
  544.     my ($return, $format) = ("int32", "int16");
  545.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  546.                         hostSelectorGremlinLimit, @_);
  547.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  548. }
  549.  
  550.  
  551. ########################################################################
  552. #
  553. #    FUNCTION:        HostGremlinNew
  554. #
  555. #    DESCRIPTION:    Start a new Gremlin Horde.
  556. #
  557. #    PARAMETERS:        Starting Gremlin number.
  558. #                    Ending Gremlin number.
  559. #                    Frequency (in terms of Gremlin events) at which
  560. #                        states are automatically saved.
  561. #                    Switching depth (number of events generated before
  562. #                        switching to a different Gremlin).
  563. #                    Max depth (maximum number of events generated
  564. #                        for each Gremlin).
  565. #                    List of application names on which to run Gremlins.
  566. #
  567. #    RETURNS:        Error code.
  568. #
  569. ########################################################################
  570.  
  571. sub HostGremlinNew
  572. {
  573.     # HostErr HostGremlinNew(const HostGremlinInfo*)
  574.  
  575.     my($start, $stop, $save_freq, $switch_depth, $max_depth, @apps) = @_;
  576.  
  577.     my ($app_string) = join (",", @apps);
  578.  
  579.     my ($struct) = pack("NNNNN", $start, $stop, $save_freq, $switch_depth, $max_depth) . $app_string;
  580.  
  581.     my ($return, $format) = ("HostErr", "int16 block");
  582.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  583.                         hostSelectorGremlinNew, $struct);
  584.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  585. }
  586.  
  587.  
  588. #/* ==================================================================== */
  589. #/* Import/export-related calls                                             */
  590. #/* ==================================================================== */
  591.  
  592.  
  593. ########################################################################
  594. #
  595. #    FUNCTION:    HostImportFile
  596. #
  597. #    DESCRIPTION:    Path to file on desktop
  598. #            Card to import file to.
  599. #
  600. #    PARAMETERS:    None
  601. #
  602. #    RETURNS:    Error code.
  603. #
  604. ########################################################################
  605.  
  606. sub HostImportFile
  607. {
  608.     # HostErr HostImportFile(const char* fileName, long cardNum)
  609.  
  610.     my ($return, $format) = ("HostErr", "int16 string int32");
  611.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  612.                         hostSelectorImportFile, @_);
  613.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  614. }
  615.  
  616.  
  617. ########################################################################
  618. #
  619. #    FUNCTION:    HostExportFile
  620. #
  621. #    DESCRIPTION:    Export a db from Emulator to the host.
  622. #
  623. #    PARAMETERS:    None
  624. #
  625. #    RETURNS:    Error code.
  626. #
  627. ########################################################################
  628.  
  629. sub HostExportFile
  630. {
  631.     # HostErr HostExportFile(const char* fileName, long cardNum, const char* dbName)
  632.  
  633.     my ($return, $format) = ("HostErr", "int16 string int32 string");
  634.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  635.                         hostSelectorExportFile, @_);
  636.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  637. }
  638.  
  639.  
  640. #/* ==================================================================== */
  641. #/* Logging-related calls                                                 */
  642. #/* ==================================================================== */
  643.  
  644.  
  645. ########################################################################
  646. #
  647. #    FUNCTION:    HostSetPreference
  648. #
  649. #    DESCRIPTION:    Set a preference.
  650. #
  651. #    PARAMETERS:    prefName, The name of the preference whose value you
  652. #                          are setting.
  653. #               prefValue, The new value of the preference.
  654. #    
  655. #    RETURNS:    Nothing.
  656. #
  657. ########################################################################
  658.  
  659. sub HostSetPreference
  660. {
  661.     # void HostSetPreference(const char*, const char*)
  662.  
  663.     my ($return, $format) = ("void", "int16 string string");
  664.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  665.                         hostSelectorSetPreference, @_);
  666.     #//EmRPC::ReturnValue ($return, $D0, $A0, @params);
  667. }
  668.  
  669.  
  670. ########################################################################
  671. #
  672. #    FUNCTION:    HostGetPreference
  673. #
  674. #    DESCRIPTION:    Export a db from Emulator to the host.
  675. #
  676. #    PARAMETERS:    prefName, The name of the preference whose value you
  677. #                  want to retrieve.
  678. #
  679. #    RETURNS:    Error code.
  680. #
  681. ########################################################################
  682.     
  683. sub HostGetPreference
  684. {
  685.     # HostBool HostGetPreference(const char*, char*)
  686.  
  687.     my ($return, $format) = ("int32", "int16 string string");
  688.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  689.                         hostSelectorGetPreference, $_[0], "");
  690.     ($D0,    prefName    => $params[1],
  691.             prefValue    => $params[2]);
  692. }
  693.  
  694.  
  695.  
  696.  
  697. ########################################################################
  698. #
  699. #    FUNCTION:        HostSetLogFileSize
  700. #
  701. #    DESCRIPTION:    Determines the size of the log file the Palm OS 
  702. #                    Emulator is using.  By default the Palm OS Emulator
  703. #                    Uses a 1 MB log file to record the last 1 MB of 
  704. #                    Log Data information.
  705. #
  706. #    PARAMETERS:        Size, The new size for the logging file in bytes.
  707. #
  708. #    RETURNS:        None.
  709. #
  710. #
  711. ########################################################################
  712.  
  713. sub HostSetLogFileSize
  714. {
  715.     # void HostSetLogFileSize(long)
  716.  
  717.     my ($return, $format) = ("int16", "int16 int32");
  718.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  719.                         hostSelectorSetLogFileSize, @_);
  720.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  721. }
  722.  
  723.  
  724. #/* ==================================================================== */
  725. #/* RPC-related calls                                                     */
  726. #/* ==================================================================== */
  727.  
  728.  
  729. ########################################################################
  730. #
  731. #    FUNCTION:        HostSessionCreate
  732. #
  733. #    DESCRIPTION:    Create a new session.
  734. #
  735. #    PARAMETERS:        Name of device to emulate.  Choices are: "Pilot",
  736. #                        "PalmPilot", "Palm III", "Palm IIIx",
  737. #                        "Palm V", "Palm VII".
  738. #                    RAM size (in K) to emulate.
  739. #                    Path to ROM to use.
  740. #
  741. #    RETURNS:        Error code.
  742. #
  743. ########################################################################
  744.  
  745. sub HostSessionCreate
  746. {
  747.     # HostErr HostSessionCreate(const char* device, long ramSize, const char* romPath)
  748.  
  749.     my ($return, $format) = ("HostErr", "int16 string int32 string");
  750.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  751.                         hostSelectorSessionCreate, @_);
  752.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  753. }
  754.  
  755.  
  756. ########################################################################
  757. #
  758. #    FUNCTION:        HostSessionOpen
  759. #
  760. #    DESCRIPTION:    Open a previously create session file.
  761. #
  762. #    PARAMETERS:        Path to session file to open.
  763. #
  764. #    RETURNS:        Error code.
  765. #
  766. ########################################################################
  767.  
  768. sub HostSessionOpen
  769. {
  770.     # HostErr HostSessionOpen(const char* psfFileName)
  771.  
  772.     my ($return, $format) = ("HostErr",  "int16 string");
  773.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  774.                         hostSelectorSessionOpen, @_);
  775.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  776. }
  777.  
  778.  
  779. ########################################################################
  780. #
  781. #    FUNCTION:        HostSessionClose
  782. #
  783. #    DESCRIPTION:    Close the current session, optionally saving it.
  784. #
  785. #    PARAMETERS:        Name of session file to create. Can be null.
  786. #
  787. #    RETURNS:        Error code.
  788. #
  789. ########################################################################
  790.  
  791. sub HostSessionClose
  792. {
  793.     # HostErr HostSessionClose(const char* saveFileName)
  794.  
  795.     my ($return, $format) = ("HostErr", "int16 string");
  796.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  797.                         hostSelectorSessionClose, @_);
  798.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  799. }
  800.  
  801.  
  802. ########################################################################
  803. #
  804. #    FUNCTION:        HostSessionQuit
  805. #
  806. #    DESCRIPTION:    Ask Palm OS Emulator to quit.
  807. #
  808. #    PARAMETERS:        None
  809. #
  810. #    RETURNS:        Error code.
  811. #
  812. ########################################################################
  813.  
  814. sub HostSessionQuit
  815. {
  816.     # HostErr HostSessionQuit(void)
  817.  
  818.     my ($return, $format) = ("HostErr", "int16");
  819.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  820.                         hostSelectorSessionQuit, @_);
  821.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  822. }
  823.  
  824.  
  825. ########################################################################
  826. #
  827. #    FUNCTION:        HostSignalSend
  828. #
  829. #    DESCRIPTION:    Sends a signal to any script that has host signal 
  830. #                    wait calls pending.
  831. #
  832. #    PARAMETERS:        signalNumber, The signal you want to wait for.
  833. #
  834. #    RETURNS:        List containing the error code and the numeric
  835. #                    signal value returned from the Emulator.
  836. #
  837. ########################################################################
  838.  
  839. sub HostSignalSend
  840. {
  841.     # HostErr HostSignalSend(HostSignal signalNumber)
  842.  
  843.     my ($return, $format) = ("HostErr", "int16 int32*");
  844.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  845.                         hostSelectorSignalSend, $_[0], 0);
  846.  
  847.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  848. }
  849.  
  850.  
  851. ########################################################################
  852. #
  853. #    FUNCTION:        HostSignalWait
  854. #
  855. #    DESCRIPTION:    Wait for a signal from the Palm OS Emulator.
  856. #
  857. #    PARAMETERS:        timeout (in milliseconds)
  858. #
  859. #    RETURNS:        List containing the error code and the numeric
  860. #                    signal value returned from the Emulator.
  861. #
  862. ########################################################################
  863.  
  864. sub HostSignalWait
  865. {
  866.     # HostErr HostSignalWait(long timeout, HostSignal* signalNumber)
  867.     
  868.     my ($return, $format) = ("HostErr", "int16 int32 rptr");
  869.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  870.                         hostSelectorSignalWait, $_[0], 0);
  871.  
  872.     ($D0, $params[2]);    # 0 = selector, 1 = timeout, 2 = signal number
  873. }
  874.  
  875.  
  876. ########################################################################
  877. #
  878. #    FUNCTION:        HostSignalResume
  879. #
  880. #    DESCRIPTION:    Tell the Emulator to resume after it has sent us
  881. #                    a signal.
  882. #
  883. #    PARAMETERS:        None
  884. #
  885. #    RETURNS:        Error code.
  886. #
  887. ########################################################################
  888.  
  889. sub HostSignalResume
  890. {
  891.     # HostErr HostSignalResume(void)
  892.  
  893.     my ($return, $format) = ("HostErr", "int16");
  894.     my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
  895.                         hostSelectorSignalResume, @_);
  896.     EmRPC::ReturnValue ($return, $D0, $A0, @params);
  897. }
  898.